<meta charset="UTF-8">
<script>
	laydate.render({
	  	elem: '#g_time1',
	  	calendar: true
	});
	laydate.render({
	  	elem: '#g_time2',
	  	calendar: true
	});
	function check(){
			var g_time1 = $("#g_time1").val();
			var g_time2 = $("#g_time2").val();
			if(g_time1==""||g_time2==""){
				bootbox.alert("请选择日期");
				return false;
			}
		}
	
</script>
<div class="modal fade" id="g_myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
	<div class="modal-dialog">
		<div class="modal-content">
		<div class="modal-header">
			<h3>时间区间导出</h3>
		</div>
		<form id="g_fm" action="ttb/export?opplyTime&opplyTime1" method="post" onsubmit="return check()">
		 	<div class="modal-body" style="height: 70px;">
				<div class="input-group has-feedback col-md-5"style="float: left; ">
					<span class="input-group-addon">起始日期</span> 
					<input type="text" class="form-control"  name="opplyTime" placeholder="选择起始日期" id="g_time1"/>
					<span class="glyphicon glyphicon-calendar form-control-feedback"></span>
				</div>
				<div class="col-md-1" style="height: 34px; line-height: 34px;">至</div>
				<div class="input-group has-feedback col-md-5"style="float: left; ">
					<span class="input-group-addon">终止日期</span> 
					<input type="text" class="form-control"  name="opplyTime1" placeholder="选择终止日期" id="g_time2"/>
					<span class="glyphicon glyphicon-calendar form-control-feedback"></span>
				</div>
			</div>
			<div class="modal-footer">
				<button type="submit" class="btn btn-success">
					<span class="glyphicon glyphicon-paste"></span> 导出
				</button>
				<button type="button" class="btn btn-danger" data-dismiss="modal">
					<span class="glyphicon glyphicon-remove"></span> 关闭
				</button>
			</div>
		</form>
		</div>
	</div>
</div>
<div id="ttbRecord_table" class="container-fluid">
	<div class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
           	<div class="modal-dialog" role="document">
                <div class="modal-content">
	                <div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
						<h3 class="modal-title" id="myModalLabel">查询</h3>
	                </div>
	               	<div class="modal-body">
		               <div class="form-group">
	                        <label for="search_name">申请人</label>
	                        <input id="search_name" type="text" class="form-control" name="name" data-bind="value:queryCondition.name">
		                 </div>
		               	<div class="form-group">
	                        <label for="search_type">调停补类型</label>
	                        <select id="search_type" class="form-control"  name="type" data-bind="value:queryCondition.type">
	                      		<option style="display: none;"></option>
								<option>停课</option>
								<option>调课</option>
								<option>补课</option>
							</select>
	                      </div>
	                    <div class="form-group">
	                 		<label for="search_state">状态查询</label>
                     		<select id="search_state" class="form-control"  name="state" data-bind="value:queryCondition.state">
	                      		<option style="display: none;"></option>
								<option>申请中</option>
								<option>已同意</option>
								<option>已拒绝</option>
							</select>
						</div>
						<div style="margin-top: 20px;"></div>
					</div>
					<div class="modal-footer">
		                <button type="button" class="btn btn-primary" data-dismiss="modal" data-bind="click:queryClick"><span class="glyphicon glyphicon-search" aria-hidden="true"></span>&nbsp;查询</button>
		                <button type="button" class="btn btn-default" data-dismiss="modal" data-bind="click:clearClick"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span>&nbsp;清空</button>
	            	</div>
                </div>
                
           	</div>
		</div> 

	<div id="toolbar" class="btn-group">
		<button data-bind="click:searchClick" type="button"
			class="btn btn-default">
			<span class="glyphicon glyphicon-search" aria-hidden="true"></span><font id="bfont"> 查询</font>
		</button>
		<button class="btn btn-default" data-toggle="modal" data-target="#g_myModal">
			<span class="glyphicon glyphicon-paste"></span> 导出
		</button>
	</div>
	
	
	<table id="mytable" data-bind="bootstrapTable:$root">
			<thead>
				<tr>
					<th data-field="user" data-formatter="nameFormatter">申请人</th>
					<th data-field="opplyTime">申请时间</th>
					<th data-field="tbClass" >班级</th>
					<th data-field="curriculum" >课程</th>
					<th data-field="type" >调停补类型</th>
					<th data-field="state" >状态</th>
				</tr>
			</thead>
		</table>
</div>
<script type="text/javascript">
/*
 * 有子类数据
 */
function nameFormatter(value){
	return value.name;
}

$(function(){
    var data =  {
	    tableParams : {
	    	url : 'ttb/page'
	    	},
	    	urls : {
	    		search:'ttb/search'
	    	},
	    	queryCondition : {
	    		type : '',
	    		state : '',
	    		name:'',
	    		capacity:''
	    	}
	};
	ko.applyBindings(new BsTableViewModel(data),document.getElementById('ttbRecord_table'));	
});
	
</script>